<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/assets/cashier/css/main.css"/>
    <link rel="stylesheet" href="/assets/cashier/css/iconfont.css">
    <link rel="stylesheet" href="/assets/cashier/css/print.css">	
    <script type="text/javascript" src="/assets/cashier/js/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/main.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="/assets/cashier/js/jquery-migrate-1.2.1.min.js"></script>
    <title>交班</title>
     <style>
    	table,table tr th, table tr td { border:1px solid #d1d1d1; }
    	.report{
			width: 100%;
			background: #fff;
		}
		.report td{
			text-align: center;
			height: 30px;
			line-height: 30px;
			width:12.5%;
			color: #808080;
		}
		.count-btn{
			margin: 0 5px;
			cursor: pointer;
			color: #00A680;
		}
		.detail{
			padding: 20px;
			border: none;
			width: 80%;
		}
		.detail td{
			text-align: center;
		}
		
		.member-nav ul{
			border-bottom: 1px solid #d1d1d1;
		    height:50px;
		    line-height: 50px;
		    color: #999;
		    font-size: 16px;
		    padding-left: 40px;
		    padding-right: 20px;
		}
		
		.member-nav ul li{
		    float: left;
		    width:110px;
		    height: 49px;
		    text-align: center;
		    cursor: pointer;
		}
		.member-nav ul li.active{
		    color: #51d4a8;
		    border-bottom: 2px solid #51d4a8;
		}
		.member-list{
			width: 100%;
		}
		
		.cashier{
			width: 100%;;	
		}
		</style>
</head>
<body>
    <div class="container">
        <div class="nav">
            <div class="user-head">
                <img src="/assets/logo.png"/>
            </div>
            <div class="nav-con">
                <ul>
                    <li class="nav-list">
                        <a href="/cashier/index/index/index">
                            <span class="iconfont icon-shouyin"></span>
                            <p data-locale="msg_shouyin">收银台</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/order">
                            <span class="iconfont icon-guadan"></span>
                            <p data-locale="msg_guadan">挂单</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/members">
	                        <span class="iconfont icon-huiyuan"></span>
	                        <p data-locale="msg_huiyuan">会员</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/count">
                            <span class="iconfont icon-tongji"></span>
                            <p data-local="msg_tongji">统计</p>
                        </a>
                    </li>
                    <li class="nav-list">
                        <a href="/cashier/index/index/change">
                            <span class="iconfont icon-tuihuo"></span>
                            <p data-locale="msg_tuihuanhuo">退换货</p>
                        </a>
                    </li>
                </ul>
            </div>
            <div class="nav-foot">
                <div class="nav-foot-list nav-lock">
                    <span class="iconfont icon-suo"></span>
                    <p data-locale="suoding">锁定</p>
                </div>
                <div class="nav-foot-list nav-cancel active">
                    <a href="/cashier/index/index/exchange">
                        <span class="iconfont icon-tuichu"></span>
                        <p data-locale="msg_jiaoban">交班</p>
                    </a>
                </div>
            </div>
        </div>
        <div class="content" style="padding: 40px">
            
            <table class="report" rules="rows"  border="1" id="tb1">
				<tbody>
					<tr >
						<td>收银员:<span class="casher"></span></td>
						<td colspan="6">工作时间:<span class="work-time"></span></td>
						<td class="cashier-print count-btn" style="color: #00A680;">打印</td>
					</tr>
					<tr>
						<td colspan="2">实际总收入</td>
						<td colspan="2">总销售额</td>
						<td colspan="2">总会员充值</td>
						<td colspan="2">总退货金额</td>
					</tr>
					<tr>
						<td colspan="2" class="allMoney"></td>
						<td colspan="2" class="allSales"></td>
						<td colspan="2" class="allRecharge"></td>
						<td colspan="2" class="allRefund"></td>
					</tr>
					<tr>
						<td>现金总收入</td>
						<td class="pay-mode-list cash" data-id="1"></td>
						<td>现金支付</td>
						<td class="sale-mode-list" data-id="1"></td>
						<td>现金支付</td>
						<td class="vip-mode-list" data-id="1"></td>
						<td>现金退款</td>
						<td class="refund-mode-list" data-id="1"></td>
					</tr>
					<tr>
						<td>银行卡总收入</td>
						<td class="pay-mode-list bank" data-id="6"></td>
						<td>银行卡支付</td>
						<td class="sale-mode-list sale-bank" data-id="6"></td>
						<td>银行卡支付</td>
						<td class="vip-mode-list vip-bank" data-id="6"></td>
						<td>银行卡退款</td>
						<td class="refund-mode-list refund-bank" data-id="6"></td>
					</tr>
					<tr>
						<td>PayM总收入</td>
						<td class="pay-mode-list paym" data-id="5"></td>
						<td>PayM支付</td>
						<td class="sale-mode-list sale-paym" data-id="5"></td>
						<td>PayM支付</td>
						<td class="vip-mode-list vip-paym" data-id="5"></td>
						<td>PayM退款</td>
						<td class="refund-mode-list refund-paym" data-id="5"></td>
					</tr>
					<tr>
						<td>Paypal总收入</td>
						<td class="pay-mode-list paypal" data-id="4"></td>
						<td>Paypal支付</td>
						<td class="sale-mode-list sale-paypal" data-id="4"></td>
						<td>Paypal支付</td>
						<td class="vip-mode-list vip-paypal" data-id="4"></td>
						<td>Paypal退款</td>
						<td class="refund-mode-list refund-paypal" data-id="4"></td>
					</tr>
					<tr>
						<td>会员卡总收入</td>
						<td class="pay-mode-list vip" data-id="0"></td>
						<td>会员卡支付</td>
						<td class="sale-mode-list sale-vip" data-id="0"></td>
						<td></td>
						<td ></td>
						<td>会员卡退款</td>
						<td class="refund-mode-list addTr refund-vip" data-id="0"></td>
					</tr>
					<tr>
						<td colspan="8"></td>
					</tr>
					<tr>
						<td>VAT</td>
						<td class="total-vat"></td>
						<td>订单数量</td>
						<td class="total-orders"></td>
						<td>新增会员</td>
						<td class="new-vip"></td>
						<td>货损商品</td>
						<td class="destory-shop"></td>
					</tr>
					<tr>
						<td colspan="2"></td>
						<td>商品数量</td>
						<td class="total-shops"></td>
						<td>新增充值金额</td>
						<td class="new-recharge-vip"></td>
						<td>退货商品</td>
						<td class="refund-shop"></td>
					</tr>
					<tr>
						<td colspan="4"></td>
						<td>会员消费人数</td>
						<td class="vip-number"></td>
						<td colspan="2"></td>
					</tr>
					
				</tbody>
			</table>
            <div class="exchange-btn" data-locale="msg_qdjb">确定交班</div>
        </div>
    </div>
    <div class="popbg">
         <div class="popbox" id="lock">
            <div class="pop-head" data-locale="msg_qxsd">请填写你的密码取消锁定</div>
            <div class="pop-body">
                <input class="lock-input" name="password">
            </div>
            <div class="pop-foot">
                <div class="centerButton lock-btn" data-locale="msg_queren">确认</div>
            </div>
        </div>
        <div id="printer">
			<div class="code"><img src="../../../assets/logo.png"/></div>
			<div class="title">日出行中国超市</div>
			<div class="en-title">Sunrise Chinese Market Ltd</div>
			<div class="address">
				<p>84 Colman Road, Norwich, NR4 7EH</p>		
				<p>01603 927952	</p>	
			</div>
			<div class="print-cashier print-item">
				<div class="line-type"><span class="pull-left offline">OFFLINE</span><span class="pull-right">收银员线下结账小票</span></div>
				<div class="print-list">收银员工：<span class="cashier-name"></span></div>
				<div class="print-list">工作时间：<span class="cashier-time"></span></div>
				<div class="print-list">VAT：<span class="totalVat"></span></div>
				<div class="line"></div>
				<div class="print-list" style="font-weight: bold;">实际总收入<span class="totalMoney pull-right">1233</span></div>
				<div class="print-list">现金总收入<span class="pay-mode-list pull-right" data-id="1"></span></div>
				<div class="print-list">银行卡总收入<span class="pay-mode-list pull-right" data-id="6"></span></div>
				<div class="print-list">payM总收入<span class="pay-mode-list pull-right" data-id="5"></span></div>
				<div class="print-list">payPal总收入<span class="pay-mode-list pull-right" data-id="4"></span></div>
				<div class="print-list">会员卡总收入<span class="pay-mode-list pull-right" data-id="0"></span></div>
				<div class="line"></div>
				<div class="print-list" style="font-weight: bold;">总销售额<span class="totalSale pull-right"></span></div>
				<div class="print-list">现金支付<span class="sale-mode-list pull-right" data-id="1"></span></div>
				<div class="print-list">银行卡支付<span class="sale-mode-list pull-right" data-id="6"></span></div>
				<div class="print-list">payM支付<span class="sale-mode-list pull-right" data-id="5"></span></div>
				<div class="print-list">payPal支付<span class="sale-mode-list pull-right" data-id="4"></span></div>
				<div class="print-list">会员卡支付<span class="sale-mode-list pull-right" data-id="0"></span></div>
				<div class="line"></div>
				<div class="print-list" style="font-weight: bold;">总会员充值<span class="totalRecharge pull-right"></span></div>
				<div class="print-list">现金支付<span class="vip-mode-list rechargeCash pull-right" data-id="1"></span></div>
				<div class="print-list">银行卡支付<span class="vip-mode-list rechargeBank pull-right" data-id="6"></span></div>
				<div class="print-list">payM支付<span class="vip-mode-list rechargePaym pull-right" data-id="5"></span></div>
				<div class="print-list">payPal支付<span class="vip-mode-list rechargePaypal pull-right" data-id="4"></span></div>
			
				<div class="line"></div>
				<div class="print-list" style="font-weight: bold;">总退货金额<span class="totalRefund pull-right"></span></div>
				<div class="print-list">现金退款<span class="refund-mode-list refundCash pull-right" data-id="1"></span></div>
				<div class="print-list">银行卡退款<span class="refund-mode-list refundBank pull-right" data-id="6"></span></div>
				<div class="print-list">payM退款<span class="refund-mode-list refundPaym pull-right" data-id="5"></span></div>
				<div class="print-list">payPal退款<span class="refund-mode-list refundPaypal pull-right" data-id="4"></span></div>
				<div class="print-list">会员卡退款<span class="refund-mode-list refundVip pull-right" data-id="0"></span></div>
				<div class="line"></div>
				<div class="print-list">订单数量<span class="totalOrder pull-right"></span></div>
				<div class="print-list">商品数量<span class="totalShop pull-right"></span></div>
				<div class="print-list">会员消费人数<span class="vipNumber pull-right"></span></div>
				<div class="print-list">新增会员<span class="newVip pull-right"></span></div>
				<div class="print-list">新增充值金额<span class="newRecharge pull-right"></span></div>
				<div class="print-list">货损商品<span class="destoryShop pull-right"></span></div>
				<div class="print-list">退货商品<span class="refundShop pull-right"></span></div>
				<div class="line"></div>
				<div class="print-time">打印时间：<span class="print-time-detail"></span></div>
				<div class="print-list">收银员签字 ：</span></div>
				<div class="print-list">经理签字：</div>
			</div>
		</div>
		<div id="online" class="print-online">
        	<div class="code"><img src="../../../assets/logo.png"/></div>
			<div class="title">日出行中国超市</div>
			<div class="en-title">Sunrise Chinese Market Ltd</div>
			<div class="address">
				<p>84 Colman Road, Norwich, NR4 7EH</p>		
				<p>01603 927952	</p>	
			</div>
			
			<div class="line-type"><span class="pull-left">ON-LINE</span><span class="pull-right">顾客线上消费送货小票</span></div>
			<div class="print-list">送货时间：<span class="delivery-time"></span></div>
			<div class="print-list">收银员工：<span class="cashier-name"></span></div>
			<div class="print-list">消费时间：<span class="order-time"></span></div>
			<div class="print-list">线上订单：<span class="order_id"></span></div>
			
			<div class="print-list vip-name-box">会员姓名：<span class="vip-name"></span></div>
			<div class="print-list">微信号码：<span class="vip-weixin"></span></div>
			<div class="print-list">送货地址：<span class="vip-address"></span></div>
			<div class="print-list">送货邮编：<span class="vip-site"></span></div>
			<div class="print-list">联系电话：<span class="vip-phone"></span></div>
			<div class="print-list">备注：<span class="vip-remark"></span></div>
			<div class="print-list">支付方式：<span class="print-order-payMode"></span></div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>单价(￡)</span>
				<span>数量</span>
				<span>金额(￡)</span>
			</div>
			<div class="line"></div>
			<div class="print-table-body"> </div>
			<div class="line"></div>
			<div class="print-table-head">
				<span>共计</span>
				<span class="print-table-total-food"></span>
				<span class="print-table-total-price"></span>
			</div>
			<div class="line"></div>
			<div class="consumption"></div>
			
			<div class="line"></div>
			<div class="print-list text-center">VAT RECEIPT SUMMARY</div>
			<div class="print-list text-center">NET：<span class="vat-net"></span></div>
			<div class="print-list text-center">20%VAT：<span class="vat-20"></span></div>
			<div class="print-list text-center">GROSS：<span class="vat-gross"></span></div>
			<div class="print-list text-center">VAT No. : 157965263</div>
			<div class="line"></div>
			<div class="print-time">打印时间：<span class="print-time-detail"></span></div>
			<div class="print-time">感谢惠顾，期待您的再次光临</div>
			<div class="print-time">加入会员，更多折扣，更多优惠，更多方便</div>
			<div class="print-time">扫我↓</div>
			<div class="code"> <img src="../../../assets/cashier/img/richubao.jpg" /></div>
		</div>
    </div>
    <div class="tip hide"></div>
    <script type="text/javascript">
        $(function () {
           lock();  

            $('.cashier-print').on('click',function(){
				$('.print-time-detail').html(getTime())
				$('#printer').show().siblings().hide();
				$('#printer').jqprint();
			});
			
            getCount();
		    function getCount(){
		    	$.ajax({
		    		type:'GET',
                    data:'',
                    dataType:'json',
                    url:urlHead+'/statistic/index',
                    success:function (json) {
                    	console.log(json)
                    	
                    	var now=new Date();
                    	var hour=now.getHours();
                    	var minute=now.getMinutes();
                    	var workTime=json.begin_time.substr(0,16);
                    	workTime=workTime+'-'+toAdd(hour)+':'+toAdd(minute);
                    	
                    	var incomeMoney=json.income_groups;//总收入
                    	var orderMoney=json.sale_groups;//订单支付方式金额
                    	var chargeMoney=json.recharge_groups;//会员支付方式金额
                    	var refundMoney=json.refund_groups;//退款
                    	
                    	
                    	$('.pay-mode-list').each(function(){
                    		var id=$(this).attr('data-id');
                        	$(this).html(0);
                        	var that=this; 
                        	$.each(incomeMoney,function(i,list){
                        		if(id == Number(list.pay_mode)){
                        			$(that).html(list.num)
                        		}
                        	})
                    	});
                    	
                    	$('.sale-mode-list').each(function(){
                    		var id=$(this).attr('data-id');
                        	$(this).html(0);
                        	var that=this; 
                        	$.each(orderMoney,function(i,list){
                        		if(id == Number(list.pay_mode)){
                        			$(that).html(Math.abs(list.num))
                        		}
                        		
                        	})
                    	});
                    	
                    	$('.vip-mode-list').each(function(){
                    		var id=$(this).attr('data-id');
                        	$(this).html(0);
                        	var that=this;
                        	$.each(chargeMoney,function(i,list){
                        		if(id == Number(list.pay_mode)){	
                        			$(that).html(list.num)
                        		}
                        	})
                    	})
                    	
                    	$('.refund-mode-list').each(function(){
                    		var id=$(this).attr('data-id');
                        	$(this).html(0);
                        	var that=this;
                        	$.each(refundMoney,function(i,list){
                        		if(id == Number(list.pay_mode)){
                        			$(that).html(list.num);
                        		}
                        	})
                    	});
              	
                    	$('.casher,.cashier-name').html(json.cashier.username);
                    	$('.work-time,.cashier-time').html(workTime);
                    	$('.allMoney,.totalMoney').html(json.total_income);
                    	$('.allSales,.totalSale').html(json.total_sale)
                    	$('.allRecharge,.totalRecharge').html(json.total_recharge)
                    	$('.allRefund,.totalRefund').html(json.total_refund);
                    	

                    	
                    	$('.total-vat,.totalVat').html(json.vat)
                    	$('.total-orders,.totalOrder').html(json.order_counts);
                    	$('.total-shops, .totalShop').html((json.item_counts*1).toFixed(2));
                    	$('.new-vip, .newVip').html(json.reg_user);
                    	$('.new-recharge-vip,.newRecharge').html(json.reg_money);
                    	$('.vip-number, .vipNumber').html(json.xiaofei_user);
                    	$('.destory-shop, .destoryShop').html(json.huosun);
                    	$('.refund-shop,.refundShop').html(json.tuihuo)
                    }
		    	})
		    }
		    
            $('.exchange-btn').click(function(){
            	$.ajax({
            		type:'POSt',
            		data:'',
            		dataType:'json',
            		url:urlHead+'/logout',
            		success:function(json){
						window.location.href=urlHead+'/index/index/login';
            		}
            	})
            	
            })
        })
    </script>
</body>
</html>